package com.example.app1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

public class Radiobuttonlayout6Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.radiobuttonlayout_6);


         RadioGroup radio = findViewById(R.id.radioGroup);

        radio.setOnCheckedChangeListener((group, checkedId) -> {
            if(checkedId == R.id.bt01){
                Toast toast = Toast.makeText(getApplicationContext(),"您选择的是春",  Toast.LENGTH_SHORT);
                toast.setGravity(Gravity.BOTTOM, 0 , 200);
                toast.show();
            }else if (checkedId == R.id.bt02){
                System.out.printf("春");
                Toast toast = Toast.makeText(getApplicationContext(),"您选择的是夏",  Toast.LENGTH_SHORT);
                toast.setGravity(Gravity.BOTTOM, 0 , 200);
                toast.show();
            }else if (checkedId == R.id.bt03){
                Toast toast = Toast.makeText(getApplicationContext(),"您选择的是秋",  Toast.LENGTH_SHORT);

                toast.setGravity(Gravity.BOTTOM, 0 , 200);

                toast.show();
            }else {
                Toast toast = Toast.makeText(getApplicationContext(),"您选择的是冬",  Toast.LENGTH_SHORT);
                toast.setGravity(Gravity.BOTTOM, 0 , 200);
                toast.show();
            }
        });

    }



}